"""
# 1 Config类
# 2 SQLAlchemy数据库配置
# 3 Redis
# 4 CSRF 同源策略
# 5 Session
# 6 Flask-Script 命令行，终端启动
# 7 数据库迁移扩展
"""
# 11.3导包
# import logging

# 6.1 Flask-Script导包
from flask_script import Manager
# 7.1 数据库迁移扩展 导包
from flask_migrate import Migrate, MigrateCommand
# 9.1 导包
from info import create_app, db, models
# 10.3导包
from config import DevelopmentConfig, ProductionCondig
# 12.1日志上下文
# from flask import current_app


# 10.4 创建对象，调动配置信息
app = create_app(DevelopmentConfig)

# 6.2 创建Manager
manager = Manager(app)


# 7.2 Migrate 创建迁移对象
Migrate(app, db)

# 7.3 给Manager绑定迁移命令 db：终端命令
manager.add_command('db', MigrateCommand)


if __name__ == '__main__':
    print(app.url_map)
    # 6.3 app替换manager
    manager.run()
